<?php

/**
 * This is the model class for table "sys_member".
 *
 * The followings are the available columns in table 'sys_member':
 * @property string $member_network_id
 * @property string $member_name
 * @property string $member_nickname
 * @property string $member_email
 * @property string $member_sex
 * @property string $member_address
 * @property string $member_city_id
 * @property string $member_state_id
 * @property string $member_country_id
 * @property string $member_zipcode
 * @property string $member_birth_place
 * @property string $member_birth_date
 * @property string $member_identity_type
 * @property string $member_identity_no
 * @property string $member_phone
 * @property string $member_fax
 * @property string $member_mobilephone
 * @property string $member_image
 * @property string $member_join_datetime
 * @property string $member_devisor_name
 * @property string $member_devisor_relationship
 * @property string $member_devisor_phone
 * @property string $member_bank_id
 * @property string $member_bank_city
 * @property string $member_bank_branch
 * @property string $member_bank_account_name
 * @property string $member_bank_account_no
 * @property string $member_tax_account_no
 * @property string $member_serial_id
 * @property string $member_register_id
 * @property string $member_last_update
 * @property string $member_last_login
 * @property string $member_is_updated_by_member
 * @property string $member_is_updated_by_admin
 * @property string $member_is_suspended
 * @property string $member_is_auto_withdrawal
 */
class SysMember extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'sys_member';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('member_register_id', 'required'),
			array('member_network_id, member_serial_id', 'length', 'max'=>20),
			array('member_name, member_nickname, member_email, member_zipcode, member_birth_place, member_identity_no, member_phone, member_fax, member_mobilephone, member_image, member_devisor_name, member_devisor_relationship, member_devisor_phone, member_bank_city, member_bank_branch, member_bank_account_name, member_bank_account_no, member_tax_account_no, member_register_id', 'length', 'max'=>255),
			array('member_sex', 'length', 'max'=>6),
			array('member_city_id, member_state_id, member_country_id, member_bank_id', 'length', 'max'=>10),
			array('member_identity_type', 'length', 'max'=>8),
			array('member_is_updated_by_member, member_is_updated_by_admin, member_is_suspended, member_is_auto_withdrawal', 'length', 'max'=>1),
			array('member_address, member_birth_date, member_join_datetime, member_last_update, member_last_login', 'safe'),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('member_network_id, member_name, member_nickname, member_email, member_sex, member_address, member_city_id, member_state_id, member_country_id, member_zipcode, member_birth_place, member_birth_date, member_identity_type, member_identity_no, member_phone, member_fax, member_mobilephone, member_image, member_join_datetime, member_devisor_name, member_devisor_relationship, member_devisor_phone, member_bank_id, member_bank_city, member_bank_branch, member_bank_account_name, member_bank_account_no, member_tax_account_no, member_serial_id, member_register_id, member_last_update, member_last_login, member_is_updated_by_member, member_is_updated_by_admin, member_is_suspended, member_is_auto_withdrawal', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'member_network_id' => 'Member Network',
			'member_name' => 'Member Name',
			'member_nickname' => 'Member Nickname',
			'member_email' => 'Member Email',
			'member_sex' => 'Member Sex',
			'member_address' => 'Member Address',
			'member_city_id' => 'Member City',
			'member_state_id' => 'Member State',
			'member_country_id' => 'Member Country',
			'member_zipcode' => 'Member Zipcode',
			'member_birth_place' => 'Member Birth Place',
			'member_birth_date' => 'Member Birth Date',
			'member_identity_type' => 'Member Identity Type',
			'member_identity_no' => 'Member Identity No',
			'member_phone' => 'Member Phone',
			'member_fax' => 'Member Fax',
			'member_mobilephone' => 'Member Mobilephone',
			'member_image' => 'Member Image',
			'member_join_datetime' => 'Member Join Datetime',
			'member_devisor_name' => 'Member Devisor Name',
			'member_devisor_relationship' => 'Member Devisor Relationship',
			'member_devisor_phone' => 'Member Devisor Phone',
			'member_bank_id' => 'Member Bank',
			'member_bank_city' => 'Member Bank City',
			'member_bank_branch' => 'Member Bank Branch',
			'member_bank_account_name' => 'Member Bank Account Name',
			'member_bank_account_no' => 'Member Bank Account No',
			'member_tax_account_no' => 'Member Tax Account No',
			'member_serial_id' => 'Member Serial',
			'member_register_id' => 'Member Register',
			'member_last_update' => 'Member Last Update',
			'member_last_login' => 'Member Last Login',
			'member_is_updated_by_member' => 'Member Is Updated By Member',
			'member_is_updated_by_admin' => 'Member Is Updated By Admin',
			'member_is_suspended' => 'Member Is Suspended',
			'member_is_auto_withdrawal' => 'Member Is Auto Withdrawal',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('member_network_id',$this->member_network_id,true);
		$criteria->compare('member_name',$this->member_name,true);
		$criteria->compare('member_nickname',$this->member_nickname,true);
		$criteria->compare('member_email',$this->member_email,true);
		$criteria->compare('member_sex',$this->member_sex,true);
		$criteria->compare('member_address',$this->member_address,true);
		$criteria->compare('member_city_id',$this->member_city_id,true);
		$criteria->compare('member_state_id',$this->member_state_id,true);
		$criteria->compare('member_country_id',$this->member_country_id,true);
		$criteria->compare('member_zipcode',$this->member_zipcode,true);
		$criteria->compare('member_birth_place',$this->member_birth_place,true);
		$criteria->compare('member_birth_date',$this->member_birth_date,true);
		$criteria->compare('member_identity_type',$this->member_identity_type,true);
		$criteria->compare('member_identity_no',$this->member_identity_no,true);
		$criteria->compare('member_phone',$this->member_phone,true);
		$criteria->compare('member_fax',$this->member_fax,true);
		$criteria->compare('member_mobilephone',$this->member_mobilephone,true);
		$criteria->compare('member_image',$this->member_image,true);
		$criteria->compare('member_join_datetime',$this->member_join_datetime,true);
		$criteria->compare('member_devisor_name',$this->member_devisor_name,true);
		$criteria->compare('member_devisor_relationship',$this->member_devisor_relationship,true);
		$criteria->compare('member_devisor_phone',$this->member_devisor_phone,true);
		$criteria->compare('member_bank_id',$this->member_bank_id,true);
		$criteria->compare('member_bank_city',$this->member_bank_city,true);
		$criteria->compare('member_bank_branch',$this->member_bank_branch,true);
		$criteria->compare('member_bank_account_name',$this->member_bank_account_name,true);
		$criteria->compare('member_bank_account_no',$this->member_bank_account_no,true);
		$criteria->compare('member_tax_account_no',$this->member_tax_account_no,true);
		$criteria->compare('member_serial_id',$this->member_serial_id,true);
		$criteria->compare('member_register_id',$this->member_register_id,true);
		$criteria->compare('member_last_update',$this->member_last_update,true);
		$criteria->compare('member_last_login',$this->member_last_login,true);
		$criteria->compare('member_is_updated_by_member',$this->member_is_updated_by_member,true);
		$criteria->compare('member_is_updated_by_admin',$this->member_is_updated_by_admin,true);
		$criteria->compare('member_is_suspended',$this->member_is_suspended,true);
		$criteria->compare('member_is_auto_withdrawal',$this->member_is_auto_withdrawal,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return SysMember the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
